package com.datamining.system.service.impl;

import com.datamining.common.annotation.DataScope;
import com.datamining.common.core.domain.entity.BusStuPaper;
import com.datamining.common.core.domain.entity.SysUser;
import com.datamining.system.mapper.*;
import com.datamining.system.service.IBusStuPaperService;
import com.datamining.system.service.ISysConfigService;
import com.datamining.system.service.ISysDeptService;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.validation.Validator;
import java.util.ArrayList;
import java.util.List;

/**
 * 试卷分析 业务层处理
 * 
 * @author datamining
 */
@Service
public class BusStuPaperServiceImpl implements IBusStuPaperService
{
    private static final Logger log = LoggerFactory.getLogger(BusStuPaperServiceImpl.class);

    @Autowired
    private SysUserMapper userMapper;

    @Autowired
    private SysRoleMapper roleMapper;

    @Autowired
    private SysPostMapper postMapper;

    @Autowired
    private SysUserRoleMapper userRoleMapper;

    @Autowired
    private SysUserPostMapper userPostMapper;

    @Autowired
    private ISysConfigService configService;

    @Autowired
    private ISysDeptService deptService;

    @Autowired
    protected Validator validator;

    /**
     * 根据条件分页查询用户列表
     * 
     * @param user 用户信息
     * @return 用户信息集合信息
     */
    @Override
    public List<BusStuPaper> selectBusStuPaper(BusStuPaper user)
    {

        String jsonString = "{\n" +
                "    \"bussNo\": \"ASN0096131\",\n" +
                "    \"pdaSaveFlag\": \"pda\",\n" +
                "    \"entryType\": 1,\n" +
                "    \"skuNameOrLotNum\":\"\"\n" +
                "}";

        Gson gson = new Gson();
        JsonObject jsonObject = gson.fromJson(jsonString, JsonObject.class);
        String name = jsonObject.get("bussNo").getAsString();
        String pda = jsonObject.get("pdaSaveFlag").getAsString();
        int age = jsonObject.get("entryType").getAsInt();
        List<BusStuPaper> list = new ArrayList<>();
        BusStuPaper stuPaper = new BusStuPaper();
        stuPaper.setUserId(1L);
        stuPaper.setPaperName(name);
        stuPaper.setErrorReasons(pda);
        list.add(stuPaper);
        return list;
//        return userMapper.selectUserList(user);
    }


}
